#pragma once

#include "clcommap.h"
#include "clcomfileparser.h"

class CCADFile
{
public:
    CCADFile(string filename, string id);
	~CCADFile();
public:
	string GetID();

	void ResetFile();

	void GetLineColumnCount(CADCOLUMNLINE& lineColumn);

	int CalcuKey(CADCOLUMNLINE& lineColumn);
	int CalcuKey(int nLine, int nColumn);

	int ParseCSVFile(const char* fileName);
	int ParseTXTFile(const char* fileName);
	int ParseCADFile(const char* fileName);

	int Save2CSVFile(const char* fileName);
	int Save2TXTFile(const char* fileName);
	int Save2CADFile(const char* fileName);

	int GetValue(CADCOLUMNLINE& lineColumn, FM_VALUE_TYPE inType, CADVALUEINFO& outValue);
	int SetValue(CADCOLUMNLINE& lineColumn, FM_VALUE_TYPE inType, CADVALUEINFO& outValue);
private:
    CLComMap<int, std::string> _mapValues;

	CADCOLUMNLINE _nMaxLineColumn;
private:
    string _id;
    string _fileName;
};

typedef CCADFile *PPARSECADFILE;
